package com.sgcc.fj.pmos.mobileapp.adapter;

import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.sgcc.fj.pmos.common.listener.OnItemClickListener;
import com.sgcc.pmos.nativesdk.R;
import com.sgcc.fj.pmos.mobileapp.bean.CommunicationAreaBean;

public class CommunicationAreaListAdapter extends BaseQuickAdapter<CommunicationAreaBean, BaseViewHolder> {

    public CommunicationAreaListAdapter() {
        super(R.layout.item_list);
    }

    private OnItemClickListener mOnItemClickListener;

    public void setOnItemClickListener(OnItemClickListener mOnItemClickListener) {
        this.mOnItemClickListener = mOnItemClickListener;
    }

    @Override
    protected void convert(BaseViewHolder baseViewHolder, CommunicationAreaBean bean) {
        baseViewHolder.setText(R.id.tv_name, bean.getLabel());
        baseViewHolder.getView(R.id.ll_content).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (mOnItemClickListener != null) {
                    mOnItemClickListener.onItemClick((CommunicationAreaBean) bean, getItemPosition(bean));
                }
            }
        });
    }

}
